<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../../css/api.css" />
		<link rel="stylesheet" type="text/css" href="../../css/style.css" />
		<style type="text/css">
			.my_center .list li{ position: relative; padding: 1px 13px;}
			.my_center .list li:active{ background-color:#f8f8f8;}
			.my_center .list .m_cell_hd img{ width: 16px; margin-right: 20px;}
			.my_center .list h4{ display:block; line-height: 50px; font-size: 15px; color: #333; font-weight: normal;}
			.my_center .list p{ font-size:13px; color: #999;}
			.my_center .list .m_cell_ft img{ width: 6px; margin-left: 10px;}
			.my_center .list li::after{ display:block; position: absolute; content: ""; left: 0; right: 0; bottom: 0; height: 1px; background-color: #ededed; -webkit-transform: scaleY(0.5); transform: scaleY(0.5);}
			.btn{ padding: 70px 15px;}
			
		</style>
	</head>
	<body>
		<div class="my_center">
			<ul class="list">
				<li class="mylist" tapmode="lipress" onclick="openNavWin('#ddd','changepwd_win','changepwd_frm.html','修改密码',false,false,true,[],{});">
					<div class="m_cell_hd m_cell_primary"><h4>修改密码</h4></div>
					<div class="m_cell_ft"><img src="../../image/img_13.png" alt="" /></div>
				</li>
				<li tapmode="lipress" style="padding-bottom:0.1rem;" onclick="clearCache();">
					<div class="m_cell_hd m_cell_primary"><h4>清空缓存</h4></div>
					<div class="m_cell_ft"><p id="cacheSize">0 M</p></div>
					<div class="m_cell_ft"><img src="../../image/img_13.png" alt="" /></div>
				</li>
				<li tapmode style="padding-bottom:0.1rem;">
					<div class="m_cell_hd m_cell_primary"><h4>版本号</h4></div>
					<div class="m_cell_ft"><p id="version"></p></div>
					<!-- <div class="m_cell_ft"><img src="../../image/img_12.png" alt="" /></div> -->
				</li>
				<li class="mylist" tapmode="lipress" onclick="openNavWin('#ddd','terms_win','../login/terms_frm.html','用户协议',false,false,true,[],{});">
					<div class="m_cell_hd m_cell_primary"><h4>用户协议</h4></div>
					<div class="m_cell_ft"><img src="../../image/img_13.png" alt="" /></div>
				</li>
			</ul>
			<ul class="btn">
				<button class="d_btn" tapmode="btnpress" id="exitapp">退出登录</button>
			</ul>
		</div>
			
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/app.js"></script>
	
	<script type="text/javascript">
		var ajpush;
		apiready = function() {
			api.parseTapmode();
			api.addEventListener({
                name: 'navitembtn'
            }, function(ret, err) {
                if (ret.type == 'left') {
					api.closeWin({
					});
                }
            });
			$api.addEvt($api.byId('exitapp'), 'click', function(){
				api.showProgress({
					title: '请稍后...',
					text: '',
					modal: true
				});
				api.removePrefs({
					key: 'user_info'
				});
				var userjson = {};
				var usersetting = 'updateuser('+ JSON.stringify(userjson) +');';
				
				//退出IM
				var rong = api.require('rongCloud2');
				rong.logout(function(ret, err) {
					console.log(JSON.stringify(err));
					if (ret.status == 'success')
					{
						api.hideProgress();
						toast("退出成功");
						setTimeout(function() {
							openNavWin('#fff','login_win','../login/login_frm.html','',true,false,false,[],{});
						}, 0);
					}
				}); // 断开，且不再接收 Push
				
			});
			
			api.getCacheSize(function(ret) {
				var size = ret.size;
				$api.text($api.byId('cacheSize'),"当前 " + (size / 1000 / 1000).toFixed(2) + " M");
			});
			$api.text($api.byId('version'),''+api.appVersion);
		}
		function clearCache() {
			//清空缓存
			if($api.text($api.byId('cacheSize')) == '0.00 M')
			{
				toast("没有可清除缓存");
				return false;
			}
			api.confirm({
				title: '清除缓存',
				msg: '是否清除 '+ $api.text($api.byId('cacheSize')) +' 缓存？',
				buttons: ['取消', '确定']
			}, function(ret, err) {
				var index = ret.buttonIndex;
				if(index == 2)
				{
					api.clearCache(function(ret, err) {
						$api.text($api.byId('cacheSize'),"0.00 M");
						toast("清除成功");
					});
				}
			});
		}
	</script>
</html>